<template>
  <div class="header wrap">
    <h1 class="l">
      <img src="@/assets/img/indexLogo.6f8ac4f0.png" alt="" class="logo" />
    </h1>
    <div class="c">
      <ul>
        <!-- <li :class="$route.path=='/home'? 'active':''">首页</li>
        <li :class="$route.path=='/goods'? 'active':''">全部商品</li>
        <li :class="$route.path=='/user'? 'active':''">个人中心</li>
        <li :class="$route.path=='/order'? 'active':''">我的订单</li>
        <li :class="$route.path=='/free'? 'active':''">专属福利</li> -->
        <li
          v-for="(item, index) in linkList"
          :key="index"
          :class="$route.path == item.path ? 'active' : ''"
          @click="hdClick(item.path)"
        >
          {{ item.innerText }}
        </li>
      </ul>
    </div>
    <div class="r">
      <input type="text" placeholder="请输入商品关键字" maxlength="10" />
      <span class="search-btn"
        ><img src="@/assets/img/search.png" alt=""
      /></span>
    </div>
  </div>
</template>

<script>
export default {
  name: "",
  components: {},
  props: {},
  data() {
    return {
      linkList: [
        {
          id: 0,
          name: "home",
          path: "/home",
          innerText: "首页",
        },
        {
          id: 1,
          name: "goods",
          path: "/goods",
          innerText: "全部商品",
        },
        {
          id: 2,
          name: "user",
          path: "/user",
          innerText: "个人中心",
        },
        {
          id: 3,
          name: "order",
          path: "/order",
          innerText: "我的订单",
        },
        {
          id: 4,
          name: "free",
          path: "/free",
          innerText: "专属福利",
        },
      ],
    };
  },
  methods: {
    hdClick(path) {
      this.$router.push({ path });
    },
  },
  watch: {},
  created() {},
  mounted() {},
  computed: {},
};
</script>

<style scoped lang="less">
.header {
  height: 118px;
  display: flex;
  justify-content: space-between;
  align-items: center;

  .l .logo {
    cursor: pointer;
  }

  .c ul {
    width: 500px;
    display: flex;
    justify-content: space-between;

    li {
      cursor: pointer;
      font-size: 16px;
      font-family: SourceHanSansSC;
    }

    .active {
      color: #0a328e;
      font-weight: 700;
    }
  }
  .r {
    display: flex;
    align-items: center;

    input {
      width: 214px;
      height: 40px;
      border: 1px solid #dedede;
      border-radius: 20px 0px 0px 20px;
      text-indent: 2em;
      outline: none;
      box-sizing: border-box;
    }

    .search-btn {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 50px;
      height: 40px;
      background: #0a328e;
      border-radius: 0px 20px 20px 0px;
      cursor: pointer;
    }
  }
}
</style>
